﻿using Abp.Domain.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AVIS.OutBound.Stores
{
    /// <summary>
    /// 门店信息（对应于avisORLocation，avisStores，avisORLocshrs）
    /// </summary>
    public class Store : Entity
    {
        /// <summary>
        /// 门店编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 英文名称
        /// </summary>
        public string ENName { get; set; }

        /// <summary>
        /// 中文名称
        /// </summary>
        public string CNName { get; set; }

        /// <summary>
        /// 纬度
        /// </summary>
        public double? Latitude { get; set; }

        /// <summary>
        /// 经度
        /// </summary>
        public double? Longitude { get; set; }

        /// <summary>
        /// 门店类型
        ///     Unmanned
        ///     City/Downtown
        ///     Railway/Bus Station
        ///     Exhibition/Conference Centre
        ///     Seaport/Dock
        ///     HQ
        ///     Delivery/Collection Unit
        ///     Downtown/Off Airport
        ///     Garage/Hotel
        ///     Airport
        /// </summary>
        public string LocationType { get; set; }

        /// <summary>
        /// 门店类型
        /// </summary>
        public StoreType StoreType
        {
            get
            {
                if (LocationType.Equals("City/Downtown", StringComparison.CurrentCultureIgnoreCase))
                {
                    return StoreType.Downtown;
                }
                else if (LocationType.Equals("Railway/Bus Station", StringComparison.CurrentCultureIgnoreCase))
                {
                    return StoreType.RailwayStation;
                }
                else if (LocationType.Equals("Airport", StringComparison.CurrentCultureIgnoreCase))
                {
                    return StoreType.Airport;
                }
                else
                {
                    return StoreType.Other;
                }
            }
        }

        /// <summary>
        /// 门店联系电话
        /// </summary>
        public string Telephone { get; set; }

        /// <summary>
        /// 门店联系传真
        /// </summary>
        public string Fax { get; set; }

        /// <summary>
        /// 门店地址
        /// </summary>
        public string LocationAddress { get; set; }

        /// <summary>
        /// 附近门店的Code, 如果值等于 999 ，则表示没有附近门店
        /// </summary>
        public string AGDCode { get; set; }

        /// <summary>
        /// 周边门店的编号
        /// </summary>
        public string NewADGCode { get; set; }

        /// <summary>
        /// 所属城市编号
        /// </summary>
        public string CityCode { get; set; }

        /// <summary>
        /// 所属城市名称
        /// </summary>
        public string CityName { get; set; }

        /// <summary>
        /// 地区编号
        /// </summary>
        public string RegionCode { get; set; }

        /// <summary>
        /// 地区名称
        /// </summary>
        public string RegionName { get; set; }

        /// <summary>
        /// 所属国家名称
        /// </summary>
        public string CountryName { get; set; }

        /// <summary>
        /// 营业时间
        /// </summary>
        public StoreHours StoreHours { get; set; }

        /// <summary>
        /// 是否热门
        /// </summary>
        public bool IsHot { get; set; }

        #region 公开方法
        /// <summary>
        /// 获取指定日期的营业时间
        /// </summary>
        public string DayOpenTime(DateTime date)
        {
            if (StoreHours != null)
            {
                return StoreHours.GetHours(date.DayOfWeek);
            }
            return string.Empty;
        }
        #endregion
    }
}

